# 数据集的可视化
import numpy as np
from matplotlib import pyplot as plt
from PIL import Image, ImageSequence

data_url = 'dataset/case7BrainMRI/case7/BrainMRI/train'
image = np.array([np.array(p) for p in ImageSequence.Iterator(Image.open(
    data_url + r'/volume.tif'
))])
label = np.array([np.array(p) for p in ImageSequence.Iterator(Image.open(
    data_url + r'/labels.tif'
))])

print(image.shape)
print(label.shape)
plt.figure(figsize=(10, 10))
plt.subplot(2, 2, 1)
plt.title('MRI')
plt.imshow(image[20], cmap='gray')
plt.subplot(2, 2, 2)
plt.title('label')
plt.imshow(label[20], cmap='grey')
plt.show()
